package org.durandj.ystream.client.ui;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;

import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

import org.durandj.ystream.client.YStreamClient;

/**
 * A dialog box containing information about the client.
 * 
 * @author durandj
 * @version 1.0
 *
 */
public class AboutDialog extends javax.swing.JDialog
{

	{
		//Set Look & Feel
		try {
			javax.swing.UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
		} catch(Exception e) {
			e.printStackTrace();
		}
	}

	private static final long serialVersionUID = -4750060714137618761L;
	private JScrollPane scroll;
	private JButton btnOk;
	private JTextArea txtAbout;

	public AboutDialog(JFrame frame)
	{
		super(frame);
		initGUI();
	}
	
	private void initGUI()
	{
		try
		{
			{
				getContentPane().setLayout(null);
				this.setResizable(false);
				this.setTitle("About YStream");
				{
					scroll = new JScrollPane();
					getContentPane().add(scroll);
					scroll.setBounds(6, 6, 582, 200);
					{
						txtAbout = new JTextArea();
						scroll.setViewportView(txtAbout);
						txtAbout.setBounds(6, 6, 582, 201);
						txtAbout.setSize(582, 200);
						txtAbout.setEditable(false);
						txtAbout.setText("YStream Client\n" +
						                 "Version " + YStreamClient.VERSION + "\n" +
						                 "Programmer(s): James Durand, Chris Feilbach, Duane Raiche, Nick Iannone\n" +
						                 "Tester(s): James Durand, Chris Feilbach, Duane Raiche, Nick Iannone");
					}
				}
				{
					btnOk = new JButton();
					getContentPane().add(btnOk);
					btnOk.setText("OK");
					btnOk.setBounds(6, 206, 582, 28);
					
					btnOk.addActionListener(new ActionListener() {
						@Override
						public void actionPerformed(ActionEvent arg0)
						{
							setVisible(false);
						}
					});
				}
			}
			this.setSize(600, 266);
			this.setLocationRelativeTo(null);
			getRootPane().setDefaultButton(btnOk);
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
	}
}
